import { Controller, Get } from '@nestjs/common';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { AppService } from './app.service';

@ApiTags('app')
@Controller()
export class AppController {
  constructor(private readonly appService: AppService) {}

  @ApiOperation({ summary: '欢迎信息', description: '返回应用的欢迎信息' })
  @ApiResponse({ status: 200, description: '成功返回欢迎信息', type: String })
  @Get()
  getHello(): string {
    return this.appService.getHello();
  }

  @ApiOperation({ summary: '获取配置信息', description: '返回应用的配置信息' })
  @ApiResponse({
    status: 200,
    description: '成功返回配置信息',
    schema: {
      type: 'object',
      properties: {
        env: { type: 'string', example: 'development' },
        version: { type: 'string', example: '1.0.0' },
      },
    },
  })
  @Get('config')
  getConfig(): Record<string, any> {
    return this.appService.getConfig();
  }
}
